package demo1;

class Shape{
    public void draw(){
        System.out.println("这是画图形的方法！");
    }
}
class Cycle extends Shape{
    @Override
    public void draw() {
        System.out.println("画⚪！");
    }
}
class Rect extends Shape{
    @Override
    public void draw() {
        System.out.println("画♦！");
    }
}
class Flower extends Shape{
    @Override
    public void draw() {
        System.out.println("画❀！");
    }
}
class Triangle extends Shape{
    @Override
    public void draw() {
        System.out.println("画▲！");
    }
}

public class TestDemo2 {



    public static void drawMap(Shape shape){
        shape.draw();
    }
    public static void main(String[] args) {
        Cycle cycle = new Cycle();
        drawMap(cycle);
        drawMap(new Rect());
        drawMap(new Flower());
        drawMap(new Triangle());
    }
}
